<?php
class Article_ArticleModel{
	
	private	$id,
			$lang,
			$dc,
			$created,
			$du,
			$updated,
			$title,
			$slug,
			$short,
			$body,
			$template;
	//private $a;
	private $dbc;
	
	public function __construct(){
		$this->dbc = Db::getInstance();
	}
	
	 
	
	public function getAll(){
		try {
		$a = $this->dbc->prepare('SELECT * FROM fse_products LIMIT 2');
		$a->execute();
		$list = $a->fetchAll(PDO::FETCH_ASSOC);
					
		$a->closeCursor();
				
		return $list;
		}catch (PDOException $err){
			//dump($err);
			new Error($err);
			
			
			//die();
			
			
		
		}
		
		
		
		
	}
	
	
	public function getItem($id){
		//$d = Db::getInstance();
		$a = $this->dbc->prepare('SELECT * FROM fse_products WHERE id = :id');
		$a->bindValue(':id', $id, PDO::PARAM_INT);
		$a->execute();
		$n = $a->fetchObject('Article_Article');
				
		//$prev = $a->fetch(PDO::FETCH_ASSOC);
		dump($n);
		return $n;
		
	}
	
	/*
	public function set($var,$value){
		
		if (key_exists($var, get_class_vars(__CLASS__))){
			
			$this->$var = $value;
		}else{
			echo 'nie ma wlasciwosci';
		}
		
		
	}
	*/
	
	
}